#include "stdafx.h"
#include "RealISub2.h"

RealISub2::RealISub2(IBase *p) : m_pBase(p)
, m_value(0)
{
}

RealISub2::~RealISub2()
{
}

HRESULT STDMETHODCALLTYPE RealISub2::QueryInterface(REFIID riid, void **ppv)
{
    return m_pBase->QueryInterface(riid, ppv);
}

ULONG STDMETHODCALLTYPE RealISub2::AddRef()
{
    return m_pBase->AddRef();
}

ULONG STDMETHODCALLTYPE RealISub2::Release()
{
    return m_pBase->Release();
}

HRESULT STDMETHODCALLTYPE RealISub2::Increment()
{
    ++m_value;
    return S_OK;
}

HRESULT STDMETHODCALLTYPE RealISub2::Decrement()
{
    --m_value;
    return S_OK;
}

HRESULT STDMETHODCALLTYPE RealISub2::GetValue(LONG *v)
{
    if (v == NULL) return E_POINTER;
    *v = m_value;
    return S_OK;
}
